From 1124ddfb32915966fc6e86fd86ab8f7023af91dd Mon Sep 17 00:00:00 2001 From: Evan Paterakis Date: Tue, 13 Jan 2026 08:13:49 +0200 Subject: [PATCH] calendar: Set weekStart from the week-start-day setting Honor the new `org.gnome.desktop.calendar.week-start-day` schema key that determines the starting week day of the calendar Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5040 Part-of: --- js/ui/calendar.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 114b3d351..d97e3bdd0 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -1,4 +1,5 @@ import Clutter from 'gi://Clutter'; +import GDesktopEnums from 'gi://GDesktopEnums'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; @@ -12,6 +13,7 @@ import {formatDateWithCFormatString} from '../misc/dateUtils.js'; import {loadInterfaceXML} from '../misc/fileUtils.js'; const SHOW_WEEKDATE_KEY = 'show-weekdate'; +const WEEK_START_DAY_KEY = 'week-start-day'; const NC_ = (context, str) => `${context}\u0004${str}`; @@ -406,9 +408,11 @@ export const Calendar = GObject.registerClass({ Signals: {'selected-date-changed': {param_types: [GLib.DateTime.$gtype]}}, }, class Calendar extends St.Widget { _init() { - this._weekStart = Shell.util_get_week_start(); this._settings = new Gio.Settings({schema_id: 'org.gnome.desktop.calendar'}); + this._settings.connect(`changed::${WEEK_START_DAY_KEY}`, this._onSettingsChange.bind(this)); + this._weekStart = this._getWeekStartDay(); + this._settings.connect(`changed::${SHOW_WEEKDATE_KEY}`, this._onSettingsChange.bind(this)); this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY); @@ -478,6 +482,14 @@ export const Calendar = GObject.registerClass({ this._update(); } + _getWeekStartDay() { + const weekStartDay = this._settings.get_enum(WEEK_START_DAY_KEY); + if (weekStartDay === GDesktopEnums.Weekday.DEFAULT) + return Shell.util_get_week_start(); + + return weekStartDay % 7; + } + _buildHeader() { const layout = this.layout_manager; const offsetCols = this._useWeekdate ? 1 : 0; @@ -606,6 +618,7 @@ export const Calendar = GObject.registerClass({ } _onSettingsChange() { + this._weekStart = this._getWeekStartDay(); this._useWeekdate = this._settings.get_boolean(SHOW_WEEKDATE_KEY); this._buildHeader(); this._rebuildCalendar(); -- 2.39.5